package myenum;

import java.util.Arrays;
import java.util.Random;

enum  CartoonCharacter implements Generator<CartoonCharacter>{
    SLAPPY,SPANKY,PUNCHY,SILLY,BOUNCY,NUTTY,BOB;

    private Random rand = new Random(47);
    @Override
    public CartoonCharacter next() {
        return values()[rand.nextInt(values().length)];
    }
}

public class EnumImplementation{
    public static <T> void printNext(Generator<T> rg){
        System.out.println(rg.next());
    }

    public static void main(String[] args) {
        CartoonCharacter cc = CartoonCharacter.BOB;
        CartoonCharacter[] enums = CartoonCharacter.values();
        System.out.println(Arrays.toString(enums));
        System.out.println("------------------------------");
        for(int i = 0;i < 10; i++){
            printNext(cc);
        }
    }
}
